<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<%--
    Document   : space
    Created on : 2020-6-2, 15:32:27
    Author     : linnanxiang
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" isELIgnored="false" %>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
        <title></title>
        <script src="${pageContext.request.contextPath}/js/jquery-3.4.1.min.js"></script>
        <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css" />
        <link rel="stylesheet" href="${pageContext.request.contextPath}/css/index.css"/>
        <link rel="stylesheet" href="${pageContext.request.contextPath}/css/comment_reply.css"/>
        <link rel="stylesheet" href="${pageContext.request.contextPath}/themes/default/default.css"/>
        <script charset="utf-8" src="${pageContext.request.contextPath}/js/kindeditor-all-min.js"></script>
        <script charset="utf-8" src="${pageContext.request.contextPath}/lang/zh_CN.js"></script>
        <script>
            var editor;
            KindEditor.ready(function (K) {
                editor = K.create('textarea[name="content"]', {
                    allowFileManager: true
                });
            });
        </script>
    </head>
    <body>
        <nav class="navbar navbar-inverse navbar-fixed-top">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand" href="#">
                        首页
                    </a>
                </div>
                <div class="collapse navbar-collapse">
                    <ul class="nav navbar-nav">
                        <li><a href="${pageContext.request.contextPath}/page/register.jsp">注册</a></li>
                        <li><a href="${pageContext.request.contextPath}/page/login.jsp">登陆</a></li>
                        <li><a href="${pageContext.request.contextPath}/page/Personalpage.jsp">个人信息</a></li>
                        <li><a href="${pageContext.request.contextPath}/log" id="log">退出登陆</a></li>

                    </ul>
                </div>
            </div>
        </nav>
        <script>
//
//            $(document).ready(function () {
//
//                //处理id为log的超链接的点击事件
//                $("#log").click(function () {
//
//                    //调用jQuery提供的ajax函数发送ajax请求给Log这个Servlet，
//
//                    $.ajax({
//                        url: 'log',
//                        type: 'GET',
//                        data: {},
//                        success: {
//                        },
//                        error: function () {
//                            alert("出现错误!");
//                        }
//                    });
//                });
//                $("#fabu").click(function () {
//                    // 取得HTML内容
////                        html = editor.html();
//
//                    // 同步数据后可以直接取得textarea的value
//                    editor.sync();
//                    html = $("#pinglun").val();
//                    $.ajax({
//                        url: 'InsertPublishServlet',
//                        type: 'POST',
//                        data: {
//                            txt: "html";
//                        },
//                        success: function () {
//                            alter("成功");
//                        },
//                        error: function (req, status, error) {
//                            alert("请求处理出错，错误信息：" + error);
//                        }
//
//                    });
//                });
//            });
        </script>
        <div class="headerwrap">
            <a href="#">
                <img class="headImg" src="${pageContext.request.contextPath}/upload/${user.userImage}" onerror="this.src='${pageContext.request.contextPath}/img/logo.jpg'"/>
                <div class="name">
                    ${user.userName}
                </div>
            </a>
        </div>
        <div class="container">
            <div class="row">
                <div class="col-md-3" style="left: -100px">
                    <h1>好友推荐</h1>
                    <c:forEach items="${users2}" var="user2">
                        <div class="mutualFriend">

                            <img class="btn" src="${pageContext.request.contextPath}/upload/${user2.userImage}" width="50px" height="50px" style="border: 1px solid #cccccc;border-radius: 50%">

                            <a class="mutualFriendName" href="#">
                                ${user2.userName}
                            </a>
                            <a class="add" href="${pageContext.request.contextPath}/InsertFriendsServlet?friendId=${user2.userId}">
                                +添加
                            </a>      
                        </div>
                    </c:forEach>
                    <!--                     Button trigger modal 
                                        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
                                            Launch demo modal
                                        </button>
                    
                                         Modal 
                                        <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
                                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                            <span aria-hidden="true">&times;</span>
                                                        </button>
                                                    </div>
                                                    <div class="modal-body">
                                                        ...
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                                        <button type="button" class="btn btn-primary">Save changes</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>-->


                </div>
                <div class="col-md-5" style="left: -60px">

                    <form role="form" method="post" action="${pageContext.request.contextPath}/InsertPublishServlet">
                        <div class="form-group">
                            <textarea name="content" style="width:200px;height:100px;" id="pinglun" placeholder="说点什么吧"></textarea>

                            <button class="btn btn-primary" id="fabu" style="margin: 10px auto" type="submit" >发布</button>
                        </div>
                    </form>

                    <c:forEach items="${publishes}" var="publishe">
                        <div class="information" style="width: 600px">
                            <img class="headPhoto" src="${pageContext.request.contextPath}/upload/${publishe.userImage}" width="60px" height="50px" style="border: 1px solid #cccccc;border-radius: 50%">
                            <div class="username">
                                ${publishe.userName}
                            </div>
                            <div class="time">
                                ${publishe.createDate}
                            </div>
                            <div class="content">
                                <div class="text">
                                    ${publishe.publishTxt}
                                </div>
                            </div>
                        </div>
                    </c:forEach>

                    <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
                    <script src="/js/jquery.comment.js" ></script>
                    <script src="http://www.jq22.com/jquery/bootstrap-3.3.4.js"></script>
<!--                    <script>
                                //初始化数据
                                var arr = [
                                    {id: 1, img: "./images/img.jpg", replyName: "帅大叔", beReplyName: "匿名", content: "同学聚会，看到当年追我的屌丝开着宝马车带着他老婆来了，他老婆是我隔壁宿舍的同班同学，心里后悔极了。", time: "2017-10-17 11:42:53", address: "深圳", osname: "", browse: "谷歌", replyBody: []},
                                    {id: 2, img: "./images/img.jpg", replyName: "匿名", beReplyName: "", content: "到菜市场买菜，看到一个孩子在看摊，我问：“一只鸡多少钱？” 那孩子回答：“23。” 我又问：“两只鸡多少钱？” 孩子愣了一下，一时间没算过来，急中生智大吼一声：“一次只能买一只！”", time: "2017-10-17 11:42:53", address: "深圳", osname: "", browse: "谷歌", replyBody: [{id: 3, img: "", replyName: "帅大叔", beReplyName: "匿名", content: "来啊，我们一起吃鸡", time: "2017-10-17 11:42:53", address: "", osname: "", browse: "谷歌"}]},
                                    {id: 3, img: "./images/img.jpg", replyName: "帅大叔", beReplyName: "匿名", content: "同学聚会，看到当年追我的屌丝开着宝马车带着他老婆来了，他老婆是我隔壁宿舍的同班同学，心里后悔极了。", time: "2017-10-17 11:42:53", address: "深圳", osname: "win10", browse: "谷歌", replyBody: []}
                                ];
                                $(function () {
                                    $(".comment-list").addCommentList({data: arr, add: ""});
                                    $("#comment").click(function () {
                                        var obj = new Object();
                                        obj.img = "./images/img.jpg";
                                        obj.replyName = "匿名";
                                        obj.content = $("#content").val();
                                        obj.browse = "深圳";
                                        obj.osname = "win10";
                                        obj.replyBody = "";
                                        $(".comment-list").addCommentList({data: [], add: obj});
                                    });
                                })

                    </script>-->

                </div>
                <div class="col-md-3" style="right: -180px;">
                    <h1>我的好友列表</h1>
                    <c:forEach items="${users}" var="user1">
                        <div class="mutualFriend">

                            <img class="btn" src="${pageContext.request.contextPath}/upload/${user1.userImage}" width="50px" height="50px" style="border: 1px solid #cccccc;border-radius: 50%">

                            <a class="mutualFriendName" href="#">
                                ${user1.userName}
                            </a>
                            <a class="add" href="${pageContext.request.contextPath}/DeleteFriendsServlet?friendId=${user1.userId}">
                                -删除
                            </a>
                        </div>
                    </c:forEach>
                </div>
            </div>
        </div>
        <div class="contact">
            <div class="container">
                <h3 class="text-center">联系我们</h3><br><br>
                <div class="row">
                    <div class="col-md-4">
                        <h3>Address</h3>
                        <h5>山东省</h5>
                    </div>
                    <div class="col-md-4">
                        <h3>Send Us A Message:</h3>
                        <h5>973207180@qq.com</h5>
                    </div>
                    <div class="col-md-4">
                        <h3>电话：17866631279</h3>
                        <h5>xxx</h5>
                    </div>
                </div>
            </div>
            <div class="footer">
                <div class="container">
                    <p>谢谢使用</p>
                    </html>
